/*
 * Simple representation of a quadtree for line segments
 */
#ifndef QUADTREE_H
#define QUADTREE_H
 
#include "Vec.h"
#include <vector>
#include <list>

class QuadTree {
  public:
    QuadTree(Vec, Vec, int max_segments = default_max_segments, int depth = default_max_depth);
    ~QuadTree();
    void updateQuadTree(std::vector<Line*>);
    void insert(std::list<Line*>);
    void push_down();
    void clear();

    Vec tl, br;
    QuadTree *parent;
    QuadTree *children[4];
    std::vector<Line*> lines;
    int size;
    int max_segments;
    int depth;

    static const int default_max_segments = 24;
    static const int default_max_depth = 4;
};

#endif
